package vtc;

public class RoundRobinConcentratorUnit extends ConcentratorUnit
{
	private int queueNumber_;
	
	RoundRobinConcentratorUnit(String id, VtcArrayBlockingQueue inQueues[], VtcArrayBlockingQueue outQueues[])
	{
		super(id, inQueues, outQueues);
		queueNumber_ = 0;
	}
	
	public void concentratorProcess() throws InterruptedException
	{
		if(!inQueues_[queueNumber_].isEmpty())
		{
			event_ =  inQueues_[queueNumber_].take();
		}
		if(queueNumber_== inQueues_.length-1)
		{
			queueNumber_ = 0;
		}
		else
		{
			queueNumber_++;
		}
		
	}
}